﻿@using Kojarskiy.Core
@model Kojarskiy.Models.SiteMap

@{
    ViewBag.Title = "Создание статической страницы";
}
           
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@Html.ActionLink("Администрирование", "Index", "Admin") | @Html.ActionLink("Страницы", "Index", "SiteMap") | @ViewBag.Title
<div style="clear: both;"></div>

<fieldset>
    <legend>@ViewBag.Title</legend>

    @using (Html.BeginForm("Create", "SiteMap", FormMethod.Post, new { enctype = "multipart/form-data", role = "form" }))
    {
        <div class="bg-danger">@Html.ValidationSummary(true)</div>    
    
        @Html.Hidden("ParentId", ViewData["ParentId"])

        <div class="form-group">
            Путь страницы: @SiteMapHelper.GetNodePathString((int)ViewData["ParentId"])           
        </div>

        <div class="form-group">
            <label>Название страницы</label>
            @Html.TextBox("PageName", "", new { @class = "form-control" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.PageName)</div>
        </div>

        <div class="form-group">
            <label>Путь страницы</label>
            @Html.TextBox("Path", "", new { @class = "form-control" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.Path)</div>
        </div>    
    
        <div class="form-group">
            <label>Контент страницы</label>
            @Html.TextArea("Content", "", new { @class = "form-control multi-line", id = "Content" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.Content)</div>
        </div>
        
        <div class="form-group">
            <label>Title страницы</label>
            @Html.TextBox("Title", "", new { @class = "form-control" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.Title)</div>
        </div>    
    
        <div class="form-group">
            <label>Description страницы</label>
            @Html.TextBox("Description", "", new { @class = "form-control" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.Description)</div>
        </div> 

        <div class="form-group">
            <label>Keywords страницы</label>
            @Html.TextBox("Keywords", "", new { @class = "form-control" })
            <div class="bg-danger">@Html.ValidationMessageFor(model => model.Keywords)</div>
        </div> 
    
        <div class="checkbox">
            <label>
                @Html.CheckBox("Show", true) Отображать страницу
            </label>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn btn-success">Создать</button>   
        </div>
    }
        
</fieldset>

<script type="text/javascript">
    $(document).ready(function () {
        CKEDITOR.replace('Content', { filebrowserUploadUrl: '/ru/home/UploadImageFromEditor' });
    });
</script>